#ifndef _WX_CLIPBRD_H_BASE_
#define _WX_CLIPBRD_H_BASE_

#include "wx/defs.h"

#if wxUSE_CLIPBOARD


#include "wx/object.h"
#include "wx/wxchar.h"

class wxDataFormat;
class wxDataObject;
class wxClipboard;

class wxClipboardBase : public wxObject {
  public:
    wxClipboardBase() {}
    virtual bool Open() = 0;
    virtual void Close() = 0;
    virtual bool IsOpened() const = 0;
    virtual bool AddData( wxDataObject *data ) = 0;
    virtual bool SetData( wxDataObject *data ) = 0;
    virtual bool IsSupported( const wxDataFormat& format ) = 0;
    virtual bool GetData( wxDataObject& data ) = 0;
    virtual void Clear() = 0;
    virtual bool Flush() { return false; }
    virtual void UsePrimarySelection( bool primary = false ) { }
    static wxClipboard *Get();
};

#define wxTheClipboard   (wxClipboard::Get())

#include "wx/gtk/clipbrd.h"

class wxClipboardLocker {
  public:
    wxClipboardLocker( wxClipboard *clipboard = ( wxClipboard * )NULL ) {
      m_clipboard = clipboard ? clipboard : wxTheClipboard;
      if( m_clipboard ) {
        m_clipboard->Open();
      }
    }

    bool operator!() const { return !m_clipboard->IsOpened(); }

    ~wxClipboardLocker() {
      if( m_clipboard ) {
        m_clipboard->Close();
      }
    }

  private:
    wxClipboard *m_clipboard;

    DECLARE_NO_COPY_CLASS( wxClipboardLocker )
};

#endif

#endif
